<template>
  <div class="showItem" >
    <span class="showItem__label" v-bind:style="labelStyle">{{ label }}{{ suffix }}</span>
    <span class="showItem__content" v-bind:style="contentStyle"> {{ value?value:"&nbsp;" }} </span>
  </div>
</template>

<script>
  export default {
    data() {
      return {};
    },
    props: {
      value: String,
      label: String,
      labelWidth: {
        type: String,
        default: "6rem"
      },
      suffix:{
        type: String,
        default: "："
      }
    },
    computed: {
      labelStyle(){
        let result = {};
        let labelWidth = this.labelWidth;
        if (labelWidth) {
          result.width = labelWidth;
        }
        return result;
      },
      contentStyle(){
        let result = {};
        let labelWidth = this.labelWidth;
        if (labelWidth) {
          result.marginLeft = labelWidth;
        }
        return result;
      }
    }
  }

</script>

<style lang="scss">
  .showItem {
    &:before, &:after {
      display: table;
      content: " ";
    }

    &__label {
      display: block;
      text-align: right;
      vertical-align: middle;
      float: left;
      font-size: 14px;
      color: #48576a;
      line-height: 1;
      padding: 11px 12px 11px 0;
      box-sizing: border-box;
    }

    &__content {
      display: block;
      line-height: 36px;
      position: relative;
      font-size: 14px;
      width: 100%;

    }
  }

</style>
